<template>
  <el-form ref="optForm" :model="form" label-width="90px">
    <div class="ledgerTitle">项目信息</div>
    <el-row>
      <el-col :span="12">
        <el-form-item label-width="110px" label="项目名称:">
          {{ form.projectName }}
        </el-form-item>
      </el-col>
    </el-row>
    <div class="ledgerTitle">会议信息</div>
    <el-row>
      <el-col :span="6">
        <el-form-item label-width="110px" label="主持人:">
          {{ form.compere }}
        </el-form-item>
      </el-col>
      <el-col :span="7">
        <el-form-item label-width="100px" label="会议日期:">
          {{ form.meetingDate }}
        </el-form-item>
      </el-col>
      <el-col :span="11">
        <el-form-item label-width="100px" label="会议名称:">
          {{ form.meetingName }}
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col>
        <el-form-item label-width="110px" label="会议地点:">
          {{ form.meetingLocation }}
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="13">
        <el-form-item label-width="110px" label="校内人员:" prop="meetingAttendees">
          {{ form.meetingAttendees }}
        </el-form-item>
      </el-col>
      <el-col :span="11">
        <el-form-item label-width="100px" label="校外人员:" prop="meetingAttendees">
          {{ form.meetingInvitees }}
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="13">
        <el-form-item label-width="110px" label="主送单位:">
          {{ form.primaryRecipient }}
        </el-form-item>
      </el-col>
      <el-col :span="11">
        <el-form-item label-width="100px" label="抄送单位:">
          {{ form.ccRecipient }}
        </el-form-item>
      </el-col>
    </el-row>
    <div class="ledgerTitle">会议记录</div>
    <el-row>
      <el-col>
        <el-form-item label-width="110px" label="会议纪要:">
          <pre class="pre-style">{{ form.meetingMinutes }}</pre>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>
import {getObj} from "@/api/adis/execute/minutes";

export default {
  name: 'MeetingAuditView',
  props: {
    id: {
      type: String,
      default: ''
    },
    params: {
      type: Object,
    },
    isAudit: {
      type: Boolean,
      default: false,
    }
  },
  components: {},
  dictTypes: ['audit_type', 'project_progress', 'audit_way', 'organization_type'],
  data() {
    return {
      tableData : [],
      form: {},
      auditView: '', // 通知书组件
      loading: false,
    }
  },
  watch:{
    id: {
      handler(val){
        if (val){
          getObj(val).then((res) => {
            if (res.data.data !== null){
              this.handleMeetingResponse(res.data.data);
              this.$emit('data-loaded', true);
            } else {
              this.$emit('data-loaded', false);
            }
          }).catch(() => {
            this.$emit('data-loaded', false);
          });
        }
      },deep: true, immediate: true
    },
    params: {
      handler(val) {
        if (val){
          this.handleMeetingResponse(val);
        }
      },deep: true, immediate: true
    },
  },
  methods: {
    handleMeetingResponse(val) {
      this.$set(this, "form", val);
      this.form.tenureDates = [this.form.tenureStartDate, this.form.tenureEndDate];
      this.form.releaseTime = this.form.updateTime.split(" ")[0]
      this.auditView = 'NoticeAuditTypeAuditView'+ this.form.auditType

      this.tableData = this.form.noticeAttachments || []
      this.tableData.forEach(item => {
        item.fileList = []
        item.attachments.forEach(col => {
          item.fileList.push({name: col.fileName, url: col.fileUrl})
        })
      })
    },
  }
}
</script>

